package com.senior.english.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.senior.english.config.LoadConfiguration;
import com.senior.english.servicesImp.ScoreService;

@Controller
public class ScoreController {
	ScoreService scoreService = (ScoreService)LoadConfiguration.loadJDBC().getBean("scoreDAO");
	@RequestMapping(value = "/viewscore/{i}", method = RequestMethod.GET)
	public String viewScore(ModelMap model,@PathVariable(value = "i") Integer i) {
		model.addAttribute("viewscore", scoreService.getScore(1,i));
		return "viewscore";
	}
	@RequestMapping(value = "/improvement/{i}", method = RequestMethod.GET)
	public String viewImprove(ModelMap model,@PathVariable(value = "i") Integer i) {
		model.addAttribute("improvement", scoreService.getImprove(1,i));
		return "improvement";
	}
	@RequestMapping(value = "/yourresult", method = RequestMethod.GET)
	public String viewUserResult(ModelMap model) {
		model.addAttribute("yourresult", scoreService.getUserResult(1));
		return "yourresult";
	}
	@RequestMapping(value = "/yourimprove", method = RequestMethod.GET)
	public String displayYourImprovePage(ModelMap model) {
		model.addAttribute("yourimprove", scoreService.getYear());
		return "yourimprove";
	}
	@RequestMapping(value = "/grammar/{i}", method = RequestMethod.GET)
	public String grammar(ModelMap model,@PathVariable(value = "i") String i) {
		model.addAttribute("grammar",scoreService.getGrammar(i));
		return "grammar";
	}
	@RequestMapping(value = "/irregularverb", method = RequestMethod.GET)
	public String irregularVerb(ModelMap model) {
		model.addAttribute("irregular",scoreService.getIrregularVerb());
		return "irregularverb";
	}
	
	@RequestMapping(value = "/vocabulary", method = RequestMethod.GET)
	public String vocabulary(ModelMap model) {
		model.addAttribute("vocabulary",scoreService.getVocabulary());
		return "vocabulary";
	}

}
